using System;
using System.Collections;
using System.ComponentModel;
using System.Configuration;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Windows.Forms;
using BizTalk.Utilities.SSO.Core;
using Microsoft.Services.Tools.BiztalkDocumenter.Core;
using Microsoft.Services.Tools.BiztalkDocumenter.Publishers.Word;
using Microsoft.Services.Tools.BizTalkOM;
using Microsoft.Services.Tools.BizTalkOM.Diagnostics;
using Microsoft.Services.Tools.Publishers.CompiledHelp;

namespace Microsoft.Services.Tools.BiztalkDocumenter
{
    /// <summary>
    ///   Summary description for Form1.
    /// </summary>
    public class FormMain : Form
    {
        private bool _drag;
        private Point _startPoint = new Point(0, 0);

        #region private fields

// ReSharper disable InconsistentNaming
        private static Documenter documenter;
        private static ExecutionMode executionMode = ExecutionMode.CommandLine;
        private static bool showUsage;
        private static BizTalkInstallation bizTalkInstallation = new BizTalkInstallation();
        private Button buttonBrowse4File;

        private Button buttonBrowse4OutputFolder;
        private Button buttonBrowse4ResourceFolder;
        private CheckBox checkBoxIncludeReferences;
        private CheckBox checkBoxRulesConfig;
        private CheckBox checkBoxShowOutput;
        private CheckedListBox checkedListBoxApplications;
        private ComboBox comboBoxOutputProvider;
        private IContainer components;
        private OpenFileDialog dlgConfigFrameworkOpenFile;
        private SaveFileDialog dlgConfigFrameworkSaveFile;
        private FolderBrowserDialog folderBrowserDialog1;
        private GroupBox groupBox1;
        private GroupBox grpBoxAdvanced;
        private ImageList imageList1;
        private Label label1;
        private Label label10;
        private Label label11;
        private Label label12;
        private Label label13;
        private Label label14;
        private Label label15;
        private Label label16;
        private Label label17;
        private Label label18;
        private Label label19;
        private Label label2;
        private Label label20;
        private Label label21;
        private Label label22;
        private Label label24;
        private Label label25;
        private Label label26;
        private Label label27;
        private Label label29;
        private Label label3;
        private Label label30;
        private Label label4;
        private Label label5;
        private Label label6;
        private Label label7;
        private Label label8;
        private Label label9;
        private Label labelTitleSO;
        private LinkLabel linkLabelGenerate;
        private LinkLabel linkLabelListOrchestrations;
        private LinkLabel linkLabelNext;
        private LinkLabel linkLabelPrevious;
        private LinkLabel linkLabelQuit;
        private LinkLabel linkLabelSaveSelectedOrchestrations;
        private LinkLabel linkLabelViewCurrentOrchectration;
        private CheckedListBox listBoxSsoApplications;
        private Panel panel1;
        private Panel panel2;
        private Panel panelHeaderDocScope;
        private Panel panelHeaderOrchestrationInfo;
        private Panel panelHeaderOuputOptions;
        private Panel panelHeaderServerOptions;
        private PictureBox pictureBox1;
        private PictureBox pictureBox2;
        private PictureBox pictureBox3;
        private PictureBox pictureBox4;
        private PictureBox pictureBox5;
        private ProgressBar progressBarMain;
        private RadioButton radioButtonEntireConfig;
        private RadioButton radioButtonSpecificBizTalkApp;
        private TabControl tabControlMain;
        private TabPage tabPageDocumentScope;
        private TabPage tabPageOrchectrationInfo;
        private TabPage tabPageOutputOptions;
        private TabPage tabPageServerOptions;
        private TabPage tabPageSsoConfig;
        private TextBox textBoxConfigFrameworkFile;
        private TextBox textBoxDatabaseName;
        private TextBox textBoxOutputDir;
        private TextBox textBoxReportTitle;
        private TextBox textBoxResourceFolder;
        private TextBox textBoxRulesDatabase;
        private TextBox textBoxRulesServer;
        private TextBox textBoxServerName;
        private TextBox textBoxSsoProd;
        private TextBox textBoxSsoTest;
        private TextBox textBoxSsoStage;
        private TextBox textBoxSsoBuild;
        private Button buttonSsoProd;
        private Button buttonSsoTest;
        private Button buttonSsoStage;
        private Button buttonSsoBuild;
        private TreeView treeViewOrchestrations;
        // ReSharper restore InconsistentNaming

        #endregion

        #region Windows Form Designer generated code

        /// <summary>
        ///   Required method for Designer support - do not modify
        ///   the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormMain));
            this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();
            this.panel2 = new System.Windows.Forms.Panel();
            this.tabControlMain = new System.Windows.Forms.TabControl();
            this.tabPageServerOptions = new System.Windows.Forms.TabPage();
            this.label25 = new System.Windows.Forms.Label();
            this.buttonBrowse4File = new System.Windows.Forms.Button();
            this.label24 = new System.Windows.Forms.Label();
            this.textBoxConfigFrameworkFile = new System.Windows.Forms.TextBox();
            this.panelHeaderServerOptions = new System.Windows.Forms.Panel();
            this.pictureBox1 = new System.Windows.Forms.PictureBox();
            this.label26 = new System.Windows.Forms.Label();
            this.labelTitleSO = new System.Windows.Forms.Label();
            this.textBoxRulesDatabase = new System.Windows.Forms.TextBox();
            this.textBoxRulesServer = new System.Windows.Forms.TextBox();
            this.label7 = new System.Windows.Forms.Label();
            this.label8 = new System.Windows.Forms.Label();
            this.checkBoxRulesConfig = new System.Windows.Forms.CheckBox();
            this.textBoxDatabaseName = new System.Windows.Forms.TextBox();
            this.textBoxServerName = new System.Windows.Forms.TextBox();
            this.label3 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.tabPageDocumentScope = new System.Windows.Forms.TabPage();
            this.panelHeaderDocScope = new System.Windows.Forms.Panel();
            this.pictureBox2 = new System.Windows.Forms.PictureBox();
            this.label27 = new System.Windows.Forms.Label();
            this.label22 = new System.Windows.Forms.Label();
            this.grpBoxAdvanced = new System.Windows.Forms.GroupBox();
            this.checkBoxIncludeReferences = new System.Windows.Forms.CheckBox();
            this.radioButtonEntireConfig = new System.Windows.Forms.RadioButton();
            this.checkedListBoxApplications = new System.Windows.Forms.CheckedListBox();
            this.radioButtonSpecificBizTalkApp = new System.Windows.Forms.RadioButton();
            this.tabPageSsoConfig = new System.Windows.Forms.TabPage();
            this.listBoxSsoApplications = new System.Windows.Forms.CheckedListBox();
            this.label20 = new System.Windows.Forms.Label();
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.textBoxSsoProd = new System.Windows.Forms.TextBox();
            this.textBoxSsoTest = new System.Windows.Forms.TextBox();
            this.textBoxSsoStage = new System.Windows.Forms.TextBox();
            this.textBoxSsoBuild = new System.Windows.Forms.TextBox();
            this.buttonSsoProd = new System.Windows.Forms.Button();
            this.buttonSsoTest = new System.Windows.Forms.Button();
            this.buttonSsoStage = new System.Windows.Forms.Button();
            this.buttonSsoBuild = new System.Windows.Forms.Button();
            this.label19 = new System.Windows.Forms.Label();
            this.label17 = new System.Windows.Forms.Label();
            this.label16 = new System.Windows.Forms.Label();
            this.label15 = new System.Windows.Forms.Label();
            this.label12 = new System.Windows.Forms.Label();
            this.panel1 = new System.Windows.Forms.Panel();
            this.pictureBox5 = new System.Windows.Forms.PictureBox();
            this.label13 = new System.Windows.Forms.Label();
            this.label14 = new System.Windows.Forms.Label();
            this.tabPageOutputOptions = new System.Windows.Forms.TabPage();
            this.panelHeaderOuputOptions = new System.Windows.Forms.Panel();
            this.pictureBox4 = new System.Windows.Forms.PictureBox();
            this.label30 = new System.Windows.Forms.Label();
            this.label18 = new System.Windows.Forms.Label();
            this.label10 = new System.Windows.Forms.Label();
            this.label9 = new System.Windows.Forms.Label();
            this.textBoxResourceFolder = new System.Windows.Forms.TextBox();
            this.label5 = new System.Windows.Forms.Label();
            this.buttonBrowse4ResourceFolder = new System.Windows.Forms.Button();
            this.checkBoxShowOutput = new System.Windows.Forms.CheckBox();
            this.textBoxReportTitle = new System.Windows.Forms.TextBox();
            this.label6 = new System.Windows.Forms.Label();
            this.label4 = new System.Windows.Forms.Label();
            this.comboBoxOutputProvider = new System.Windows.Forms.ComboBox();
            this.textBoxOutputDir = new System.Windows.Forms.TextBox();
            this.label1 = new System.Windows.Forms.Label();
            this.buttonBrowse4OutputFolder = new System.Windows.Forms.Button();
            this.tabPageOrchectrationInfo = new System.Windows.Forms.TabPage();
            this.panelHeaderOrchestrationInfo = new System.Windows.Forms.Panel();
            this.pictureBox3 = new System.Windows.Forms.PictureBox();
            this.label29 = new System.Windows.Forms.Label();
            this.label21 = new System.Windows.Forms.Label();
            this.label11 = new System.Windows.Forms.Label();
            this.treeViewOrchestrations = new System.Windows.Forms.TreeView();
            this.linkLabelListOrchestrations = new System.Windows.Forms.LinkLabel();
            this.linkLabelSaveSelectedOrchestrations = new System.Windows.Forms.LinkLabel();
            this.linkLabelViewCurrentOrchectration = new System.Windows.Forms.LinkLabel();
            this.imageList1 = new System.Windows.Forms.ImageList(this.components);
            this.dlgConfigFrameworkOpenFile = new System.Windows.Forms.OpenFileDialog();
            this.dlgConfigFrameworkSaveFile = new System.Windows.Forms.SaveFileDialog();
            this.progressBarMain = new System.Windows.Forms.ProgressBar();
            this.linkLabelQuit = new System.Windows.Forms.LinkLabel();
            this.linkLabelPrevious = new System.Windows.Forms.LinkLabel();
            this.linkLabelNext = new System.Windows.Forms.LinkLabel();
            this.linkLabelGenerate = new System.Windows.Forms.LinkLabel();
            this.panel2.SuspendLayout();
            this.tabControlMain.SuspendLayout();
            this.tabPageServerOptions.SuspendLayout();
            this.panelHeaderServerOptions.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
            this.tabPageDocumentScope.SuspendLayout();
            this.panelHeaderDocScope.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
            this.grpBoxAdvanced.SuspendLayout();
            this.tabPageSsoConfig.SuspendLayout();
            this.groupBox1.SuspendLayout();
            this.panel1.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).BeginInit();
            this.tabPageOutputOptions.SuspendLayout();
            this.panelHeaderOuputOptions.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit();
            this.tabPageOrchectrationInfo.SuspendLayout();
            this.panelHeaderOrchestrationInfo.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit();
            this.SuspendLayout();
            // 
            // panel2
            // 
            this.panel2.Controls.Add(this.tabControlMain);
            this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
            this.panel2.Location = new System.Drawing.Point(0, 0);
            this.panel2.Name = "panel2";
            this.panel2.Size = new System.Drawing.Size(555, 432);
            this.panel2.TabIndex = 23;
            // 
            // tabControlMain
            // 
            this.tabControlMain.Controls.Add(this.tabPageServerOptions);
            this.tabControlMain.Controls.Add(this.tabPageDocumentScope);
            this.tabControlMain.Controls.Add(this.tabPageSsoConfig);
            this.tabControlMain.Controls.Add(this.tabPageOutputOptions);
            this.tabControlMain.Controls.Add(this.tabPageOrchectrationInfo);
            this.tabControlMain.Location = new System.Drawing.Point(-8, -24);
            this.tabControlMain.Name = "tabControlMain";
            this.tabControlMain.SelectedIndex = 0;
            this.tabControlMain.Size = new System.Drawing.Size(568, 478);
            this.tabControlMain.TabIndex = 34;
            // 
            // tabPageServerOptions
            // 
            this.tabPageServerOptions.BackColor = System.Drawing.Color.White;
            this.tabPageServerOptions.Controls.Add(this.label25);
            this.tabPageServerOptions.Controls.Add(this.buttonBrowse4File);
            this.tabPageServerOptions.Controls.Add(this.label24);
            this.tabPageServerOptions.Controls.Add(this.textBoxConfigFrameworkFile);
            this.tabPageServerOptions.Controls.Add(this.panelHeaderServerOptions);
            this.tabPageServerOptions.Controls.Add(this.textBoxRulesDatabase);
            this.tabPageServerOptions.Controls.Add(this.textBoxRulesServer);
            this.tabPageServerOptions.Controls.Add(this.label7);
            this.tabPageServerOptions.Controls.Add(this.label8);
            this.tabPageServerOptions.Controls.Add(this.checkBoxRulesConfig);
            this.tabPageServerOptions.Controls.Add(this.textBoxDatabaseName);
            this.tabPageServerOptions.Controls.Add(this.textBoxServerName);
            this.tabPageServerOptions.Controls.Add(this.label3);
            this.tabPageServerOptions.Controls.Add(this.label2);
            this.tabPageServerOptions.Location = new System.Drawing.Point(4, 22);
            this.tabPageServerOptions.Name = "tabPageServerOptions";
            this.tabPageServerOptions.Size = new System.Drawing.Size(560, 452);
            this.tabPageServerOptions.TabIndex = 0;
            // 
            // label25
            // 
            this.label25.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label25.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.label25.Location = new System.Drawing.Point(112, 325);
            this.label25.Name = "label25";
            this.label25.Size = new System.Drawing.Size(384, 32);
            this.label25.TabIndex = 59;
            this.label25.Text = "Optional: Include the ConfigFramework.exe output XML to generate a system configu" +
                "ration overview";
            // 
            // buttonBrowse4File
            // 
            this.buttonBrowse4File.BackColor = System.Drawing.Color.Silver;
            this.buttonBrowse4File.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.buttonBrowse4File.Location = new System.Drawing.Point(429, 373);
            this.buttonBrowse4File.Name = "buttonBrowse4File";
            this.buttonBrowse4File.Size = new System.Drawing.Size(24, 19);
            this.buttonBrowse4File.TabIndex = 58;
            this.buttonBrowse4File.Text = "...";
            this.buttonBrowse4File.UseVisualStyleBackColor = false;
            this.buttonBrowse4File.Click += new System.EventHandler(this.ButtonbuttonBrowse4FileClick);
            // 
            // label24
            // 
            this.label24.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label24.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.label24.Location = new System.Drawing.Point(112, 375);
            this.label24.Name = "label24";
            this.label24.Size = new System.Drawing.Size(160, 16);
            this.label24.TabIndex = 57;
            this.label24.Text = "ConfigFramework Output XML:";
            // 
            // textBoxConfigFrameworkFile
            // 
            this.textBoxConfigFrameworkFile.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.textBoxConfigFrameworkFile.Location = new System.Drawing.Point(272, 373);
            this.textBoxConfigFrameworkFile.Name = "textBoxConfigFrameworkFile";
            this.textBoxConfigFrameworkFile.Size = new System.Drawing.Size(152, 20);
            this.textBoxConfigFrameworkFile.TabIndex = 56;
            // 
            // panelHeaderServerOptions
            // 
            this.panelHeaderServerOptions.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(206)))), ((int)(((byte)(48)))), ((int)(((byte)(21)))));
            this.panelHeaderServerOptions.Controls.Add(this.pictureBox1);
            this.panelHeaderServerOptions.Controls.Add(this.label26);
            this.panelHeaderServerOptions.Controls.Add(this.labelTitleSO);
            this.panelHeaderServerOptions.Dock = System.Windows.Forms.DockStyle.Top;
            this.panelHeaderServerOptions.Location = new System.Drawing.Point(0, 0);
            this.panelHeaderServerOptions.Name = "panelHeaderServerOptions";
            this.panelHeaderServerOptions.Size = new System.Drawing.Size(560, 40);
            this.panelHeaderServerOptions.TabIndex = 55;
            // 
            // pictureBox1
            // 
            this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
            this.pictureBox1.Location = new System.Drawing.Point(7, 1);
            this.pictureBox1.Name = "pictureBox1";
            this.pictureBox1.Size = new System.Drawing.Size(40, 38);
            this.pictureBox1.TabIndex = 3;
            this.pictureBox1.TabStop = false;
            this.pictureBox1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseDown);
            this.pictureBox1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseMove);
            this.pictureBox1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseUp);
            // 
            // label26
            // 
            this.label26.ForeColor = System.Drawing.Color.White;
            this.label26.Location = new System.Drawing.Point(48, 24);
            this.label26.Name = "label26";
            this.label26.Size = new System.Drawing.Size(100, 23);
            this.label26.TabIndex = 2;
            this.label26.Text = "Server Options";
            this.label26.MouseDown += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseDown);
            this.label26.MouseMove += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseMove);
            this.label26.MouseUp += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseUp);
            // 
            // labelTitleSO
            // 
            this.labelTitleSO.BackColor = System.Drawing.Color.Transparent;
            this.labelTitleSO.Font = new System.Drawing.Font("Verdana", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.labelTitleSO.ForeColor = System.Drawing.Color.White;
            this.labelTitleSO.Location = new System.Drawing.Point(48, 6);
            this.labelTitleSO.Name = "labelTitleSO";
            this.labelTitleSO.Size = new System.Drawing.Size(392, 23);
            this.labelTitleSO.TabIndex = 1;
            this.labelTitleSO.Text = "Microsoft Services BizTalk Documenter";
            this.labelTitleSO.MouseDown += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseDown);
            this.labelTitleSO.MouseMove += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseMove);
            this.labelTitleSO.MouseUp += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseUp);
            // 
            // textBoxRulesDatabase
            // 
            this.textBoxRulesDatabase.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.textBoxRulesDatabase.Enabled = false;
            this.textBoxRulesDatabase.Location = new System.Drawing.Point(272, 228);
            this.textBoxRulesDatabase.Name = "textBoxRulesDatabase";
            this.textBoxRulesDatabase.Size = new System.Drawing.Size(152, 20);
            this.textBoxRulesDatabase.TabIndex = 52;
            // 
            // textBoxRulesServer
            // 
            this.textBoxRulesServer.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.textBoxRulesServer.Enabled = false;
            this.textBoxRulesServer.Location = new System.Drawing.Point(272, 204);
            this.textBoxRulesServer.Name = "textBoxRulesServer";
            this.textBoxRulesServer.Size = new System.Drawing.Size(152, 20);
            this.textBoxRulesServer.TabIndex = 49;
            // 
            // label7
            // 
            this.label7.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label7.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.label7.Location = new System.Drawing.Point(64, 230);
            this.label7.Name = "label7";
            this.label7.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
            this.label7.Size = new System.Drawing.Size(192, 16);
            this.label7.TabIndex = 51;
            this.label7.Text = "Rules Engine Database Name";
            // 
            // label8
            // 
            this.label8.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label8.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.label8.Location = new System.Drawing.Point(80, 206);
            this.label8.Name = "label8";
            this.label8.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
            this.label8.Size = new System.Drawing.Size(176, 16);
            this.label8.TabIndex = 50;
            this.label8.Text = "Rules Engine Server Name";
            // 
            // checkBoxRulesConfig
            // 
            this.checkBoxRulesConfig.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.checkBoxRulesConfig.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.checkBoxRulesConfig.Location = new System.Drawing.Point(184, 174);
            this.checkBoxRulesConfig.Name = "checkBoxRulesConfig";
            this.checkBoxRulesConfig.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
            this.checkBoxRulesConfig.Size = new System.Drawing.Size(240, 24);
            this.checkBoxRulesConfig.TabIndex = 48;
            this.checkBoxRulesConfig.Text = "Include Rules Engine Documentation";
            this.checkBoxRulesConfig.CheckedChanged += new System.EventHandler(this.IncludeRulesChecked);
            // 
            // textBoxDatabaseName
            // 
            this.textBoxDatabaseName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.textBoxDatabaseName.Location = new System.Drawing.Point(272, 82);
            this.textBoxDatabaseName.Name = "textBoxDatabaseName";
            this.textBoxDatabaseName.Size = new System.Drawing.Size(152, 20);
            this.textBoxDatabaseName.TabIndex = 40;
            // 
            // textBoxServerName
            // 
            this.textBoxServerName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.textBoxServerName.Location = new System.Drawing.Point(272, 58);
            this.textBoxServerName.Name = "textBoxServerName";
            this.textBoxServerName.Size = new System.Drawing.Size(152, 20);
            this.textBoxServerName.TabIndex = 34;
            // 
            // label3
            // 
            this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.label3.Location = new System.Drawing.Point(64, 82);
            this.label3.Name = "label3";
            this.label3.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
            this.label3.Size = new System.Drawing.Size(192, 16);
            this.label3.TabIndex = 39;
            this.label3.Text = "Management Database Name";
            // 
            // label2
            // 
            this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.label2.Location = new System.Drawing.Point(80, 58);
            this.label2.Name = "label2";
            this.label2.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
            this.label2.Size = new System.Drawing.Size(176, 16);
            this.label2.TabIndex = 38;
            this.label2.Text = "Management Server Name";
            // 
            // tabPageDocumentScope
            // 
            this.tabPageDocumentScope.BackColor = System.Drawing.Color.White;
            this.tabPageDocumentScope.Controls.Add(this.panelHeaderDocScope);
            this.tabPageDocumentScope.Controls.Add(this.grpBoxAdvanced);
            this.tabPageDocumentScope.Location = new System.Drawing.Point(4, 22);
            this.tabPageDocumentScope.Name = "tabPageDocumentScope";
            this.tabPageDocumentScope.Size = new System.Drawing.Size(560, 452);
            this.tabPageDocumentScope.TabIndex = 1;
            this.tabPageDocumentScope.Text = "Advanced";
            // 
            // panelHeaderDocScope
            // 
            this.panelHeaderDocScope.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(206)))), ((int)(((byte)(48)))), ((int)(((byte)(21)))));
            this.panelHeaderDocScope.Controls.Add(this.pictureBox2);
            this.panelHeaderDocScope.Controls.Add(this.label27);
            this.panelHeaderDocScope.Controls.Add(this.label22);
            this.panelHeaderDocScope.Dock = System.Windows.Forms.DockStyle.Top;
            this.panelHeaderDocScope.Location = new System.Drawing.Point(0, 0);
            this.panelHeaderDocScope.Name = "panelHeaderDocScope";
            this.panelHeaderDocScope.Size = new System.Drawing.Size(560, 40);
            this.panelHeaderDocScope.TabIndex = 55;
            // 
            // pictureBox2
            // 
            this.pictureBox2.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox2.Image")));
            this.pictureBox2.Location = new System.Drawing.Point(8, 1);
            this.pictureBox2.Name = "pictureBox2";
            this.pictureBox2.Size = new System.Drawing.Size(40, 38);
            this.pictureBox2.TabIndex = 4;
            this.pictureBox2.TabStop = false;
            this.pictureBox2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseDown);
            this.pictureBox2.MouseMove += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseMove);
            this.pictureBox2.MouseUp += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseUp);
            // 
            // label27
            // 
            this.label27.ForeColor = System.Drawing.Color.White;
            this.label27.Location = new System.Drawing.Point(48, 24);
            this.label27.Name = "label27";
            this.label27.Size = new System.Drawing.Size(152, 23);
            this.label27.TabIndex = 3;
            this.label27.Text = "Select Documentation Type";
            this.label27.MouseDown += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseDown);
            this.label27.MouseMove += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseMove);
            this.label27.MouseUp += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseUp);
            // 
            // label22
            // 
            this.label22.BackColor = System.Drawing.Color.Transparent;
            this.label22.Font = new System.Drawing.Font("Verdana", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label22.ForeColor = System.Drawing.Color.White;
            this.label22.Location = new System.Drawing.Point(48, 6);
            this.label22.Name = "label22";
            this.label22.Size = new System.Drawing.Size(392, 23);
            this.label22.TabIndex = 1;
            this.label22.Text = "Microsoft Services BizTalk Documenter";
            this.label22.MouseDown += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseDown);
            this.label22.MouseMove += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseMove);
            this.label22.MouseUp += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseUp);
            // 
            // grpBoxAdvanced
            // 
            this.grpBoxAdvanced.Controls.Add(this.checkBoxIncludeReferences);
            this.grpBoxAdvanced.Controls.Add(this.radioButtonEntireConfig);
            this.grpBoxAdvanced.Controls.Add(this.checkedListBoxApplications);
            this.grpBoxAdvanced.Controls.Add(this.radioButtonSpecificBizTalkApp);
            this.grpBoxAdvanced.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.grpBoxAdvanced.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.grpBoxAdvanced.Location = new System.Drawing.Point(21, 100);
            this.grpBoxAdvanced.Name = "grpBoxAdvanced";
            this.grpBoxAdvanced.Size = new System.Drawing.Size(499, 287);
            this.grpBoxAdvanced.TabIndex = 32;
            this.grpBoxAdvanced.TabStop = false;
            this.grpBoxAdvanced.Text = "Options";
            // 
            // checkBoxIncludeReferences
            // 
            this.checkBoxIncludeReferences.AutoSize = true;
            this.checkBoxIncludeReferences.Checked = true;
            this.checkBoxIncludeReferences.CheckState = System.Windows.Forms.CheckState.Checked;
            this.checkBoxIncludeReferences.Enabled = false;
            this.checkBoxIncludeReferences.Location = new System.Drawing.Point(15, 259);
            this.checkBoxIncludeReferences.Name = "checkBoxIncludeReferences";
            this.checkBoxIncludeReferences.Size = new System.Drawing.Size(174, 17);
            this.checkBoxIncludeReferences.TabIndex = 4;
            this.checkBoxIncludeReferences.Text = "Include referenced applications";
            // 
            // radioButtonEntireConfig
            // 
            this.radioButtonEntireConfig.Checked = true;
            this.radioButtonEntireConfig.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.radioButtonEntireConfig.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.radioButtonEntireConfig.Location = new System.Drawing.Point(16, 24);
            this.radioButtonEntireConfig.Name = "radioButtonEntireConfig";
            this.radioButtonEntireConfig.Size = new System.Drawing.Size(248, 24);
            this.radioButtonEntireConfig.TabIndex = 3;
            this.radioButtonEntireConfig.TabStop = true;
            this.radioButtonEntireConfig.Text = "Document Entire Configuration";
            // 
            // checkedListBoxApplications
            // 
            this.checkedListBoxApplications.BackColor = System.Drawing.SystemColors.InactiveBorder;
            this.checkedListBoxApplications.CheckOnClick = true;
            this.checkedListBoxApplications.Enabled = false;
            this.checkedListBoxApplications.FormattingEnabled = true;
            this.checkedListBoxApplications.HorizontalScrollbar = true;
            this.checkedListBoxApplications.Location = new System.Drawing.Point(16, 78);
            this.checkedListBoxApplications.Name = "checkedListBoxApplications";
            this.checkedListBoxApplications.Size = new System.Drawing.Size(472, 169);
            this.checkedListBoxApplications.Sorted = true;
            this.checkedListBoxApplications.TabIndex = 2;
            // 
            // radioButtonSpecificBizTalkApp
            // 
            this.radioButtonSpecificBizTalkApp.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.radioButtonSpecificBizTalkApp.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.radioButtonSpecificBizTalkApp.Location = new System.Drawing.Point(16, 46);
            this.radioButtonSpecificBizTalkApp.Name = "radioButtonSpecificBizTalkApp";
            this.radioButtonSpecificBizTalkApp.Size = new System.Drawing.Size(248, 24);
            this.radioButtonSpecificBizTalkApp.TabIndex = 0;
            this.radioButtonSpecificBizTalkApp.Text = "Specific BizTalk Application";
            this.radioButtonSpecificBizTalkApp.CheckedChanged += new System.EventHandler(this.RadioButtonSpecificBizTalkAppCheckedChanged);
            // 
            // tabPageSsoConfig
            // 
            this.tabPageSsoConfig.BackColor = System.Drawing.Color.White;
            this.tabPageSsoConfig.Controls.Add(this.listBoxSsoApplications);
            this.tabPageSsoConfig.Controls.Add(this.label20);
            this.tabPageSsoConfig.Controls.Add(this.groupBox1);
            this.tabPageSsoConfig.Controls.Add(this.panel1);
            this.tabPageSsoConfig.Location = new System.Drawing.Point(4, 22);
            this.tabPageSsoConfig.Name = "tabPageSsoConfig";
            this.tabPageSsoConfig.Size = new System.Drawing.Size(560, 452);
            this.tabPageSsoConfig.TabIndex = 4;
            this.tabPageSsoConfig.Text = "SSO Config";
            // 
            // listBoxSsoApplications
            // 
            this.listBoxSsoApplications.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.listBoxSsoApplications.CheckOnClick = true;
            this.listBoxSsoApplications.FormattingEnabled = true;
            this.listBoxSsoApplications.Location = new System.Drawing.Point(31, 78);
            this.listBoxSsoApplications.Name = "listBoxSsoApplications";
            this.listBoxSsoApplications.Size = new System.Drawing.Size(487, 167);
            this.listBoxSsoApplications.TabIndex = 92;
            // 
            // label20
            // 
            this.label20.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label20.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.label20.Location = new System.Drawing.Point(25, 47);
            this.label20.Name = "label20";
            this.label20.Size = new System.Drawing.Size(493, 33);
            this.label20.TabIndex = 91;
            this.label20.Text = "Select the SSO Applications whose key/value pairs you would like included in the " +
                "documentation (Included under seperate heading)";
            // 
            // groupBox1
            // 
            this.groupBox1.Controls.Add(this.textBoxSsoProd);
            this.groupBox1.Controls.Add(this.textBoxSsoTest);
            this.groupBox1.Controls.Add(this.textBoxSsoStage);
            this.groupBox1.Controls.Add(this.textBoxSsoBuild);
            this.groupBox1.Controls.Add(this.buttonSsoProd);
            this.groupBox1.Controls.Add(this.buttonSsoTest);
            this.groupBox1.Controls.Add(this.buttonSsoStage);
            this.groupBox1.Controls.Add(this.buttonSsoBuild);
            this.groupBox1.Controls.Add(this.label19);
            this.groupBox1.Controls.Add(this.label17);
            this.groupBox1.Controls.Add(this.label16);
            this.groupBox1.Controls.Add(this.label15);
            this.groupBox1.Controls.Add(this.label12);
            this.groupBox1.Location = new System.Drawing.Point(16, 260);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(519, 175);
            this.groupBox1.TabIndex = 78;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "Include exported SSO application configurations";
            // 
            // textBoxSsoProd
            // 
            this.textBoxSsoProd.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.textBoxSsoProd.Location = new System.Drawing.Point(161, 147);
            this.textBoxSsoProd.Name = "textBoxSsoProd";
            this.textBoxSsoProd.Size = new System.Drawing.Size(310, 20);
            this.textBoxSsoProd.TabIndex = 99;
            // 
            // textBoxSsoTest
            // 
            this.textBoxSsoTest.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.textBoxSsoTest.Location = new System.Drawing.Point(161, 121);
            this.textBoxSsoTest.Name = "textBoxSsoTest";
            this.textBoxSsoTest.Size = new System.Drawing.Size(310, 20);
            this.textBoxSsoTest.TabIndex = 98;
            // 
            // textBoxSsoStage
            // 
            this.textBoxSsoStage.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.textBoxSsoStage.Location = new System.Drawing.Point(162, 95);
            this.textBoxSsoStage.Name = "textBoxSsoStage";
            this.textBoxSsoStage.Size = new System.Drawing.Size(310, 20);
            this.textBoxSsoStage.TabIndex = 97;
            // 
            // textBoxSsoBuild
            // 
            this.textBoxSsoBuild.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.textBoxSsoBuild.Location = new System.Drawing.Point(162, 69);
            this.textBoxSsoBuild.Name = "textBoxSsoBuild";
            this.textBoxSsoBuild.Size = new System.Drawing.Size(310, 20);
            this.textBoxSsoBuild.TabIndex = 96;
            // 
            // buttonSsoProd
            // 
            this.buttonSsoProd.BackColor = System.Drawing.Color.Silver;
            this.buttonSsoProd.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.buttonSsoProd.Location = new System.Drawing.Point(478, 146);
            this.buttonSsoProd.Name = "buttonSsoProd";
            this.buttonSsoProd.Size = new System.Drawing.Size(35, 22);
            this.buttonSsoProd.TabIndex = 95;
            this.buttonSsoProd.Text = "...";
            this.buttonSsoProd.UseVisualStyleBackColor = false;
            this.buttonSsoProd.Click += new System.EventHandler(this.ButtonSsoClick);
            // 
            // buttonSsoTest
            // 
            this.buttonSsoTest.BackColor = System.Drawing.Color.Silver;
            this.buttonSsoTest.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.buttonSsoTest.Location = new System.Drawing.Point(478, 120);
            this.buttonSsoTest.Name = "buttonSsoTest";
            this.buttonSsoTest.Size = new System.Drawing.Size(35, 22);
            this.buttonSsoTest.TabIndex = 94;
            this.buttonSsoTest.Text = "...";
            this.buttonSsoTest.UseVisualStyleBackColor = false;
            this.buttonSsoTest.Click += new System.EventHandler(this.ButtonSsoClick);
            // 
            // buttonSsoStage
            // 
            this.buttonSsoStage.BackColor = System.Drawing.Color.Silver;
            this.buttonSsoStage.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.buttonSsoStage.Location = new System.Drawing.Point(478, 94);
            this.buttonSsoStage.Name = "buttonSsoStage";
            this.buttonSsoStage.Size = new System.Drawing.Size(35, 22);
            this.buttonSsoStage.TabIndex = 93;
            this.buttonSsoStage.Text = "...";
            this.buttonSsoStage.UseVisualStyleBackColor = false;
            this.buttonSsoStage.Click += new System.EventHandler(this.ButtonSsoClick);
            // 
            // buttonSsoBuild
            // 
            this.buttonSsoBuild.BackColor = System.Drawing.Color.Silver;
            this.buttonSsoBuild.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.buttonSsoBuild.Location = new System.Drawing.Point(478, 68);
            this.buttonSsoBuild.Name = "buttonSsoBuild";
            this.buttonSsoBuild.Size = new System.Drawing.Size(35, 22);
            this.buttonSsoBuild.TabIndex = 92;
            this.buttonSsoBuild.Text = "...";
            this.buttonSsoBuild.UseVisualStyleBackColor = false;
            this.buttonSsoBuild.Click += new System.EventHandler(this.ButtonSsoClick);
            // 
            // label19
            // 
            this.label19.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label19.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.label19.Location = new System.Drawing.Point(12, 22);
            this.label19.Name = "label19";
            this.label19.Size = new System.Drawing.Size(493, 42);
            this.label19.TabIndex = 90;
            this.label19.Text = resources.GetString("label19.Text");
            // 
            // label17
            // 
            this.label17.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label17.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.label17.Location = new System.Drawing.Point(12, 148);
            this.label17.Name = "label17";
            this.label17.Size = new System.Drawing.Size(143, 18);
            this.label17.TabIndex = 84;
            this.label17.Text = "SSO Configuration PROD:";
            // 
            // label16
            // 
            this.label16.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label16.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.label16.Location = new System.Drawing.Point(12, 122);
            this.label16.Name = "label16";
            this.label16.Size = new System.Drawing.Size(143, 18);
            this.label16.TabIndex = 82;
            this.label16.Text = "SSO Configuration TEST:";
            // 
            // label15
            // 
            this.label15.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label15.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.label15.Location = new System.Drawing.Point(12, 96);
            this.label15.Name = "label15";
            this.label15.Size = new System.Drawing.Size(143, 18);
            this.label15.TabIndex = 80;
            this.label15.Text = "SSO Configuration STAGE:";
            // 
            // label12
            // 
            this.label12.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label12.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.label12.Location = new System.Drawing.Point(12, 70);
            this.label12.Name = "label12";
            this.label12.Size = new System.Drawing.Size(143, 18);
            this.label12.TabIndex = 78;
            this.label12.Text = "SSO Configuration BUILD:";
            // 
            // panel1
            // 
            this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(206)))), ((int)(((byte)(48)))), ((int)(((byte)(21)))));
            this.panel1.Controls.Add(this.pictureBox5);
            this.panel1.Controls.Add(this.label13);
            this.panel1.Controls.Add(this.label14);
            this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
            this.panel1.Location = new System.Drawing.Point(0, 0);
            this.panel1.Name = "panel1";
            this.panel1.Size = new System.Drawing.Size(560, 40);
            this.panel1.TabIndex = 62;
            this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseDown);
            this.panel1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseMove);
            this.panel1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseUp);
            // 
            // pictureBox5
            // 
            this.pictureBox5.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox5.Image")));
            this.pictureBox5.Location = new System.Drawing.Point(7, 1);
            this.pictureBox5.Name = "pictureBox5";
            this.pictureBox5.Size = new System.Drawing.Size(40, 38);
            this.pictureBox5.TabIndex = 3;
            this.pictureBox5.TabStop = false;
            this.pictureBox5.MouseDown += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseDown);
            this.pictureBox5.MouseMove += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseMove);
            this.pictureBox5.MouseUp += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseUp);
            // 
            // label13
            // 
            this.label13.ForeColor = System.Drawing.Color.White;
            this.label13.Location = new System.Drawing.Point(48, 24);
            this.label13.Name = "label13";
            this.label13.Size = new System.Drawing.Size(100, 23);
            this.label13.TabIndex = 2;
            this.label13.Text = "SSO Configuration";
            this.label13.MouseDown += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseDown);
            this.label13.MouseMove += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseMove);
            this.label13.MouseUp += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseUp);
            // 
            // label14
            // 
            this.label14.BackColor = System.Drawing.Color.Transparent;
            this.label14.Font = new System.Drawing.Font("Verdana", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label14.ForeColor = System.Drawing.Color.White;
            this.label14.Location = new System.Drawing.Point(48, 6);
            this.label14.Name = "label14";
            this.label14.Size = new System.Drawing.Size(392, 23);
            this.label14.TabIndex = 1;
            this.label14.Text = "Microsoft Services BizTalk Documenter";
            this.label14.MouseDown += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseDown);
            this.label14.MouseMove += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseMove);
            this.label14.MouseUp += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseUp);
            // 
            // tabPageOutputOptions
            // 
            this.tabPageOutputOptions.BackColor = System.Drawing.Color.White;
            this.tabPageOutputOptions.Controls.Add(this.panelHeaderOuputOptions);
            this.tabPageOutputOptions.Controls.Add(this.label10);
            this.tabPageOutputOptions.Controls.Add(this.label9);
            this.tabPageOutputOptions.Controls.Add(this.textBoxResourceFolder);
            this.tabPageOutputOptions.Controls.Add(this.label5);
            this.tabPageOutputOptions.Controls.Add(this.buttonBrowse4ResourceFolder);
            this.tabPageOutputOptions.Controls.Add(this.checkBoxShowOutput);
            this.tabPageOutputOptions.Controls.Add(this.textBoxReportTitle);
            this.tabPageOutputOptions.Controls.Add(this.label6);
            this.tabPageOutputOptions.Controls.Add(this.label4);
            this.tabPageOutputOptions.Controls.Add(this.comboBoxOutputProvider);
            this.tabPageOutputOptions.Controls.Add(this.textBoxOutputDir);
            this.tabPageOutputOptions.Controls.Add(this.label1);
            this.tabPageOutputOptions.Controls.Add(this.buttonBrowse4OutputFolder);
            this.tabPageOutputOptions.Location = new System.Drawing.Point(4, 22);
            this.tabPageOutputOptions.Name = "tabPageOutputOptions";
            this.tabPageOutputOptions.Size = new System.Drawing.Size(560, 452);
            this.tabPageOutputOptions.TabIndex = 3;
            this.tabPageOutputOptions.Text = "Output";
            // 
            // panelHeaderOuputOptions
            // 
            this.panelHeaderOuputOptions.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(206)))), ((int)(((byte)(48)))), ((int)(((byte)(21)))));
            this.panelHeaderOuputOptions.Controls.Add(this.pictureBox4);
            this.panelHeaderOuputOptions.Controls.Add(this.label30);
            this.panelHeaderOuputOptions.Controls.Add(this.label18);
            this.panelHeaderOuputOptions.Dock = System.Windows.Forms.DockStyle.Top;
            this.panelHeaderOuputOptions.Location = new System.Drawing.Point(0, 0);
            this.panelHeaderOuputOptions.Name = "panelHeaderOuputOptions";
            this.panelHeaderOuputOptions.Size = new System.Drawing.Size(560, 40);
            this.panelHeaderOuputOptions.TabIndex = 61;
            // 
            // pictureBox4
            // 
            this.pictureBox4.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox4.Image")));
            this.pictureBox4.Location = new System.Drawing.Point(8, 1);
            this.pictureBox4.Name = "pictureBox4";
            this.pictureBox4.Size = new System.Drawing.Size(40, 38);
            this.pictureBox4.TabIndex = 5;
            this.pictureBox4.TabStop = false;
            this.pictureBox4.MouseDown += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseDown);
            this.pictureBox4.MouseMove += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseMove);
            this.pictureBox4.MouseUp += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseUp);
            // 
            // label30
            // 
            this.label30.ForeColor = System.Drawing.Color.White;
            this.label30.Location = new System.Drawing.Point(48, 24);
            this.label30.Name = "label30";
            this.label30.Size = new System.Drawing.Size(152, 23);
            this.label30.TabIndex = 4;
            this.label30.Text = "Output Options";
            this.label30.MouseDown += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseDown);
            this.label30.MouseMove += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseMove);
            this.label30.MouseUp += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseUp);
            // 
            // label18
            // 
            this.label18.BackColor = System.Drawing.Color.Transparent;
            this.label18.Font = new System.Drawing.Font("Verdana", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label18.ForeColor = System.Drawing.Color.White;
            this.label18.Location = new System.Drawing.Point(48, 6);
            this.label18.Name = "label18";
            this.label18.Size = new System.Drawing.Size(392, 23);
            this.label18.TabIndex = 1;
            this.label18.Text = "Microsoft Services BizTalk Documenter";
            this.label18.MouseDown += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseDown);
            this.label18.MouseMove += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseMove);
            this.label18.MouseUp += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseUp);
            // 
            // label10
            // 
            this.label10.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label10.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.label10.Location = new System.Drawing.Point(16, 236);
            this.label10.Name = "label10";
            this.label10.Size = new System.Drawing.Size(480, 80);
            this.label10.TabIndex = 60;
            this.label10.Text = resources.GetString("label10.Text");
            this.label10.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            // 
            // label9
            // 
            this.label9.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label9.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.label9.Location = new System.Drawing.Point(40, 188);
            this.label9.Name = "label9";
            this.label9.Size = new System.Drawing.Size(440, 48);
            this.label9.TabIndex = 59;
            this.label9.Text = "If you are using the CHM output provider you may specify the name of a folder con" +
                "taining a \'titlePage.htm\' and any associated images to produce a custom look and" +
                " feel to your CHM title page.";
            this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            // 
            // textBoxResourceFolder
            // 
            this.textBoxResourceFolder.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.textBoxResourceFolder.Location = new System.Drawing.Point(184, 325);
            this.textBoxResourceFolder.Name = "textBoxResourceFolder";
            this.textBoxResourceFolder.Size = new System.Drawing.Size(208, 20);
            this.textBoxResourceFolder.TabIndex = 56;
            // 
            // label5
            // 
            this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.label5.Location = new System.Drawing.Point(72, 327);
            this.label5.Name = "label5";
            this.label5.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
            this.label5.Size = new System.Drawing.Size(104, 16);
            this.label5.TabIndex = 58;
            this.label5.Text = "Resource Folder";
            // 
            // buttonBrowse4ResourceFolder
            // 
            this.buttonBrowse4ResourceFolder.BackColor = System.Drawing.Color.Silver;
            this.buttonBrowse4ResourceFolder.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.buttonBrowse4ResourceFolder.Location = new System.Drawing.Point(397, 325);
            this.buttonBrowse4ResourceFolder.Name = "buttonBrowse4ResourceFolder";
            this.buttonBrowse4ResourceFolder.Size = new System.Drawing.Size(24, 19);
            this.buttonBrowse4ResourceFolder.TabIndex = 57;
            this.buttonBrowse4ResourceFolder.Text = "...";
            this.buttonBrowse4ResourceFolder.UseVisualStyleBackColor = false;
            this.buttonBrowse4ResourceFolder.Click += new System.EventHandler(this.ButtonBrowse4ResourceFolderClick);
            // 
            // checkBoxShowOutput
            // 
            this.checkBoxShowOutput.Checked = true;
            this.checkBoxShowOutput.CheckState = System.Windows.Forms.CheckState.Checked;
            this.checkBoxShowOutput.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.checkBoxShowOutput.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.checkBoxShowOutput.Location = new System.Drawing.Point(184, 392);
            this.checkBoxShowOutput.Name = "checkBoxShowOutput";
            this.checkBoxShowOutput.Size = new System.Drawing.Size(200, 24);
            this.checkBoxShowOutput.TabIndex = 55;
            this.checkBoxShowOutput.Text = "Show Output On Completion";
            // 
            // textBoxReportTitle
            // 
            this.textBoxReportTitle.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.textBoxReportTitle.Location = new System.Drawing.Point(184, 80);
            this.textBoxReportTitle.Name = "textBoxReportTitle";
            this.textBoxReportTitle.Size = new System.Drawing.Size(227, 20);
            this.textBoxReportTitle.TabIndex = 53;
            // 
            // label6
            // 
            this.label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label6.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.label6.Location = new System.Drawing.Point(104, 82);
            this.label6.Name = "label6";
            this.label6.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
            this.label6.Size = new System.Drawing.Size(72, 16);
            this.label6.TabIndex = 54;
            this.label6.Text = "Report Title";
            // 
            // label4
            // 
            this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.label4.Location = new System.Drawing.Point(80, 130);
            this.label4.Name = "label4";
            this.label4.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
            this.label4.Size = new System.Drawing.Size(96, 16);
            this.label4.TabIndex = 52;
            this.label4.Text = "Output Provider";
            // 
            // comboBoxOutputProvider
            // 
            this.comboBoxOutputProvider.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.comboBoxOutputProvider.FormattingEnabled = true;
            this.comboBoxOutputProvider.Location = new System.Drawing.Point(184, 128);
            this.comboBoxOutputProvider.Name = "comboBoxOutputProvider";
            this.comboBoxOutputProvider.Size = new System.Drawing.Size(229, 21);
            this.comboBoxOutputProvider.TabIndex = 51;
            this.comboBoxOutputProvider.SelectedIndexChanged += new System.EventHandler(this.ComboBoxOutputProviderSelectedIndexChanged);
            // 
            // textBoxOutputDir
            // 
            this.textBoxOutputDir.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.textBoxOutputDir.Location = new System.Drawing.Point(184, 104);
            this.textBoxOutputDir.Name = "textBoxOutputDir";
            this.textBoxOutputDir.Size = new System.Drawing.Size(200, 20);
            this.textBoxOutputDir.TabIndex = 48;
            // 
            // label1
            // 
            this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.label1.Location = new System.Drawing.Point(96, 106);
            this.label1.Name = "label1";
            this.label1.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
            this.label1.Size = new System.Drawing.Size(80, 16);
            this.label1.TabIndex = 50;
            this.label1.Text = "Output Folder";
            // 
            // buttonBrowse4OutputFolder
            // 
            this.buttonBrowse4OutputFolder.BackColor = System.Drawing.Color.Silver;
            this.buttonBrowse4OutputFolder.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.buttonBrowse4OutputFolder.Location = new System.Drawing.Point(388, 104);
            this.buttonBrowse4OutputFolder.Name = "buttonBrowse4OutputFolder";
            this.buttonBrowse4OutputFolder.Size = new System.Drawing.Size(24, 19);
            this.buttonBrowse4OutputFolder.TabIndex = 49;
            this.buttonBrowse4OutputFolder.Text = "...";
            this.buttonBrowse4OutputFolder.UseVisualStyleBackColor = false;
            this.buttonBrowse4OutputFolder.Click += new System.EventHandler(this.Browse4OutputFolderClick);
            // 
            // tabPageOrchectrationInfo
            // 
            this.tabPageOrchectrationInfo.BackColor = System.Drawing.Color.White;
            this.tabPageOrchectrationInfo.Controls.Add(this.panelHeaderOrchestrationInfo);
            this.tabPageOrchectrationInfo.Controls.Add(this.label11);
            this.tabPageOrchectrationInfo.Controls.Add(this.treeViewOrchestrations);
            this.tabPageOrchectrationInfo.Controls.Add(this.linkLabelListOrchestrations);
            this.tabPageOrchectrationInfo.Controls.Add(this.linkLabelSaveSelectedOrchestrations);
            this.tabPageOrchectrationInfo.Controls.Add(this.linkLabelViewCurrentOrchectration);
            this.tabPageOrchectrationInfo.Location = new System.Drawing.Point(4, 22);
            this.tabPageOrchectrationInfo.Name = "tabPageOrchectrationInfo";
            this.tabPageOrchectrationInfo.Size = new System.Drawing.Size(560, 452);
            this.tabPageOrchectrationInfo.TabIndex = 2;
            this.tabPageOrchectrationInfo.Text = "Orchestration Info";
            // 
            // panelHeaderOrchestrationInfo
            // 
            this.panelHeaderOrchestrationInfo.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(206)))), ((int)(((byte)(48)))), ((int)(((byte)(21)))));
            this.panelHeaderOrchestrationInfo.Controls.Add(this.pictureBox3);
            this.panelHeaderOrchestrationInfo.Controls.Add(this.label29);
            this.panelHeaderOrchestrationInfo.Controls.Add(this.label21);
            this.panelHeaderOrchestrationInfo.Dock = System.Windows.Forms.DockStyle.Top;
            this.panelHeaderOrchestrationInfo.Location = new System.Drawing.Point(0, 0);
            this.panelHeaderOrchestrationInfo.Name = "panelHeaderOrchestrationInfo";
            this.panelHeaderOrchestrationInfo.Size = new System.Drawing.Size(560, 40);
            this.panelHeaderOrchestrationInfo.TabIndex = 65;
            // 
            // pictureBox3
            // 
            this.pictureBox3.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox3.Image")));
            this.pictureBox3.Location = new System.Drawing.Point(8, 1);
            this.pictureBox3.Name = "pictureBox3";
            this.pictureBox3.Size = new System.Drawing.Size(40, 38);
            this.pictureBox3.TabIndex = 5;
            this.pictureBox3.TabStop = false;
            this.pictureBox3.MouseDown += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseDown);
            this.pictureBox3.MouseMove += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseMove);
            this.pictureBox3.MouseUp += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseUp);
            // 
            // label29
            // 
            this.label29.ForeColor = System.Drawing.Color.White;
            this.label29.Location = new System.Drawing.Point(48, 24);
            this.label29.Name = "label29";
            this.label29.Size = new System.Drawing.Size(152, 23);
            this.label29.TabIndex = 4;
            this.label29.Text = "Orchestration Info";
            this.label29.MouseDown += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseDown);
            this.label29.MouseMove += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseMove);
            this.label29.MouseUp += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseUp);
            // 
            // label21
            // 
            this.label21.BackColor = System.Drawing.Color.Transparent;
            this.label21.Font = new System.Drawing.Font("Verdana", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label21.ForeColor = System.Drawing.Color.White;
            this.label21.Location = new System.Drawing.Point(48, 6);
            this.label21.Name = "label21";
            this.label21.Size = new System.Drawing.Size(392, 23);
            this.label21.TabIndex = 1;
            this.label21.Text = "Microsoft Services BizTalk Documenter";
            this.label21.MouseDown += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseDown);
            this.label21.MouseMove += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseMove);
            this.label21.MouseUp += new System.Windows.Forms.MouseEventHandler(this.HeaderMouseUp);
            // 
            // label11
            // 
            this.label11.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label11.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.label11.Location = new System.Drawing.Point(24, 56);
            this.label11.Name = "label11";
            this.label11.Size = new System.Drawing.Size(496, 40);
            this.label11.TabIndex = 60;
            this.label11.Text = resources.GetString("label11.Text");
            this.label11.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            // 
            // treeViewOrchestrations
            // 
            this.treeViewOrchestrations.CheckBoxes = true;
            this.treeViewOrchestrations.Location = new System.Drawing.Point(16, 152);
            this.treeViewOrchestrations.Name = "treeViewOrchestrations";
            this.treeViewOrchestrations.Size = new System.Drawing.Size(504, 200);
            this.treeViewOrchestrations.Sorted = true;
            this.treeViewOrchestrations.TabIndex = 0;
            this.treeViewOrchestrations.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.TreeViewOrchestrationsAfterCheck);
            this.treeViewOrchestrations.DoubleClick += new System.EventHandler(this.TreeViewOrchestrationsDoubleClick);
            // 
            // linkLabelListOrchestrations
            // 
            this.linkLabelListOrchestrations.ActiveLinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.linkLabelListOrchestrations.DisabledLinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.linkLabelListOrchestrations.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.linkLabelListOrchestrations.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.linkLabelListOrchestrations.Image = ((System.Drawing.Image)(resources.GetObject("linkLabelListOrchestrations.Image")));
            this.linkLabelListOrchestrations.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.linkLabelListOrchestrations.LinkArea = new System.Windows.Forms.LinkArea(0, 19);
            this.linkLabelListOrchestrations.LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline;
            this.linkLabelListOrchestrations.LinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.linkLabelListOrchestrations.Location = new System.Drawing.Point(16, 120);
            this.linkLabelListOrchestrations.Name = "linkLabelListOrchestrations";
            this.linkLabelListOrchestrations.Size = new System.Drawing.Size(139, 23);
            this.linkLabelListOrchestrations.TabIndex = 64;
            this.linkLabelListOrchestrations.TabStop = true;
            this.linkLabelListOrchestrations.Text = "List Orchestrations";
            this.linkLabelListOrchestrations.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.linkLabelListOrchestrations.VisitedLinkColor = System.Drawing.Color.RoyalBlue;
            this.linkLabelListOrchestrations.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.LinkLabelListOrchestrationsLinkClicked);
            // 
            // linkLabelSaveSelectedOrchestrations
            // 
            this.linkLabelSaveSelectedOrchestrations.ActiveLinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.linkLabelSaveSelectedOrchestrations.DisabledLinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.linkLabelSaveSelectedOrchestrations.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.linkLabelSaveSelectedOrchestrations.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.linkLabelSaveSelectedOrchestrations.Image = ((System.Drawing.Image)(resources.GetObject("linkLabelSaveSelectedOrchestrations.Image")));
            this.linkLabelSaveSelectedOrchestrations.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.linkLabelSaveSelectedOrchestrations.LinkArea = new System.Windows.Forms.LinkArea(0, 28);
            this.linkLabelSaveSelectedOrchestrations.LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline;
            this.linkLabelSaveSelectedOrchestrations.LinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.linkLabelSaveSelectedOrchestrations.Location = new System.Drawing.Point(236, 368);
            this.linkLabelSaveSelectedOrchestrations.Name = "linkLabelSaveSelectedOrchestrations";
            this.linkLabelSaveSelectedOrchestrations.Size = new System.Drawing.Size(205, 23);
            this.linkLabelSaveSelectedOrchestrations.TabIndex = 63;
            this.linkLabelSaveSelectedOrchestrations.TabStop = true;
            this.linkLabelSaveSelectedOrchestrations.Text = "Save Selected Orchestrations";
            this.linkLabelSaveSelectedOrchestrations.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.linkLabelSaveSelectedOrchestrations.VisitedLinkColor = System.Drawing.Color.RoyalBlue;
            this.linkLabelSaveSelectedOrchestrations.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.LinkLabelSaveSelectedOrchestrationsLinkClicked);
            // 
            // linkLabelViewCurrentOrchectration
            // 
            this.linkLabelViewCurrentOrchectration.ActiveLinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.linkLabelViewCurrentOrchectration.DisabledLinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.linkLabelViewCurrentOrchectration.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.linkLabelViewCurrentOrchectration.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.linkLabelViewCurrentOrchectration.Image = ((System.Drawing.Image)(resources.GetObject("linkLabelViewCurrentOrchectration.Image")));
            this.linkLabelViewCurrentOrchectration.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.linkLabelViewCurrentOrchectration.LinkArea = new System.Windows.Forms.LinkArea(0, 26);
            this.linkLabelViewCurrentOrchectration.LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline;
            this.linkLabelViewCurrentOrchectration.LinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.linkLabelViewCurrentOrchectration.Location = new System.Drawing.Point(20, 368);
            this.linkLabelViewCurrentOrchectration.Name = "linkLabelViewCurrentOrchectration";
            this.linkLabelViewCurrentOrchectration.Size = new System.Drawing.Size(187, 23);
            this.linkLabelViewCurrentOrchectration.TabIndex = 62;
            this.linkLabelViewCurrentOrchectration.TabStop = true;
            this.linkLabelViewCurrentOrchectration.Text = "View Current Orchestration";
            this.linkLabelViewCurrentOrchectration.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.linkLabelViewCurrentOrchectration.VisitedLinkColor = System.Drawing.Color.RoyalBlue;
            this.linkLabelViewCurrentOrchectration.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.LinkLabelViewCurrentOrchectrationLinkClicked);
            // 
            // imageList1
            // 
            this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
            this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
            this.imageList1.Images.SetKeyName(0, "");
            this.imageList1.Images.SetKeyName(1, "");
            this.imageList1.Images.SetKeyName(2, "");
            this.imageList1.Images.SetKeyName(3, "");
            this.imageList1.Images.SetKeyName(4, "");
            this.imageList1.Images.SetKeyName(5, "");
            this.imageList1.Images.SetKeyName(6, "");
            this.imageList1.Images.SetKeyName(7, "");
            this.imageList1.Images.SetKeyName(8, "");
            this.imageList1.Images.SetKeyName(9, "");
            // 
            // dlgConfigFrameworkOpenFile
            // 
            this.dlgConfigFrameworkOpenFile.Filter = "XML Files|*.xml";
            this.dlgConfigFrameworkOpenFile.Title = "Select configuration file";
            // 
            // dlgConfigFrameworkSaveFile
            // 
            this.dlgConfigFrameworkSaveFile.Filter = "XML Files|*.xml";
            this.dlgConfigFrameworkSaveFile.Title = "Save configuration file";
            // 
            // progressBarMain
            // 
            this.progressBarMain.Location = new System.Drawing.Point(241, 535);
            this.progressBarMain.Name = "progressBarMain";
            this.progressBarMain.Size = new System.Drawing.Size(288, 16);
            this.progressBarMain.TabIndex = 55;
            this.progressBarMain.Visible = false;
            // 
            // linkLabelQuit
            // 
            this.linkLabelQuit.ActiveLinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.linkLabelQuit.DisabledLinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.linkLabelQuit.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.linkLabelQuit.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.linkLabelQuit.Image = ((System.Drawing.Image)(resources.GetObject("linkLabelQuit.Image")));
            this.linkLabelQuit.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.linkLabelQuit.LinkArea = new System.Windows.Forms.LinkArea(0, 4);
            this.linkLabelQuit.LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline;
            this.linkLabelQuit.LinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.linkLabelQuit.Location = new System.Drawing.Point(441, 535);
            this.linkLabelQuit.Name = "linkLabelQuit";
            this.linkLabelQuit.Size = new System.Drawing.Size(88, 23);
            this.linkLabelQuit.TabIndex = 57;
            this.linkLabelQuit.TabStop = true;
            this.linkLabelQuit.Text = "Quit";
            this.linkLabelQuit.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            this.linkLabelQuit.VisitedLinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.linkLabelQuit.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.LinkLabelQuitLinkClicked);
            // 
            // linkLabelPrevious
            // 
            this.linkLabelPrevious.ActiveLinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.linkLabelPrevious.DisabledLinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.linkLabelPrevious.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.linkLabelPrevious.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.linkLabelPrevious.Image = global::Microsoft.Services.Tools.BiztalkDocumenter.Properties.Resources.PreviousButton;
            this.linkLabelPrevious.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.linkLabelPrevious.LinkArea = new System.Windows.Forms.LinkArea(0, 25);
            this.linkLabelPrevious.LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline;
            this.linkLabelPrevious.LinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.linkLabelPrevious.Location = new System.Drawing.Point(21, 509);
            this.linkLabelPrevious.Name = "linkLabelPrevious";
            this.linkLabelPrevious.Size = new System.Drawing.Size(109, 23);
            this.linkLabelPrevious.TabIndex = 60;
            this.linkLabelPrevious.TabStop = true;
            this.linkLabelPrevious.Text = "Previous";
            this.linkLabelPrevious.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            this.linkLabelPrevious.UseCompatibleTextRendering = true;
            this.linkLabelPrevious.VisitedLinkColor = System.Drawing.Color.RoyalBlue;
            this.linkLabelPrevious.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.LinkLabelPreviousLinkClicked);
            // 
            // linkLabelNext
            // 
            this.linkLabelNext.ActiveLinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.linkLabelNext.DisabledLinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.linkLabelNext.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.linkLabelNext.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.linkLabelNext.Image = ((System.Drawing.Image)(resources.GetObject("linkLabelNext.Image")));
            this.linkLabelNext.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.linkLabelNext.LinkArea = new System.Windows.Forms.LinkArea(0, 25);
            this.linkLabelNext.LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline;
            this.linkLabelNext.LinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.linkLabelNext.Location = new System.Drawing.Point(444, 509);
            this.linkLabelNext.Name = "linkLabelNext";
            this.linkLabelNext.Size = new System.Drawing.Size(85, 23);
            this.linkLabelNext.TabIndex = 59;
            this.linkLabelNext.TabStop = true;
            this.linkLabelNext.Text = "Next";
            this.linkLabelNext.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            this.linkLabelNext.UseCompatibleTextRendering = true;
            this.linkLabelNext.VisitedLinkColor = System.Drawing.Color.RoyalBlue;
            this.linkLabelNext.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.LinkLabelNextLinkClicked);
            // 
            // linkLabelGenerate
            // 
            this.linkLabelGenerate.ActiveLinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.linkLabelGenerate.DisabledLinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.linkLabelGenerate.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.linkLabelGenerate.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.linkLabelGenerate.Image = ((System.Drawing.Image)(resources.GetObject("linkLabelGenerate.Image")));
            this.linkLabelGenerate.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.linkLabelGenerate.LinkArea = new System.Windows.Forms.LinkArea(0, 22);
            this.linkLabelGenerate.LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline;
            this.linkLabelGenerate.LinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.linkLabelGenerate.Location = new System.Drawing.Point(21, 532);
            this.linkLabelGenerate.Name = "linkLabelGenerate";
            this.linkLabelGenerate.Size = new System.Drawing.Size(176, 23);
            this.linkLabelGenerate.TabIndex = 32;
            this.linkLabelGenerate.TabStop = true;
            this.linkLabelGenerate.Text = "Generate Documentation";
            this.linkLabelGenerate.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.linkLabelGenerate.VisitedLinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(119)))), ((int)(((byte)(153)))));
            this.linkLabelGenerate.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.LinkLabelGenerateLinkClicked);
            // 
            // FormMain
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.BackColor = System.Drawing.Color.White;
            this.CancelButton = this.linkLabelQuit;
            this.ClientSize = new System.Drawing.Size(555, 577);
            this.ControlBox = false;
            this.Controls.Add(this.linkLabelPrevious);
            this.Controls.Add(this.linkLabelNext);
            this.Controls.Add(this.linkLabelQuit);
            this.Controls.Add(this.progressBarMain);
            this.Controls.Add(this.linkLabelGenerate);
            this.Controls.Add(this.panel2);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            this.Name = "FormMain";
            this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Load += new System.EventHandler(this.FormMainLoad);
            this.panel2.ResumeLayout(false);
            this.tabControlMain.ResumeLayout(false);
            this.tabPageServerOptions.ResumeLayout(false);
            this.tabPageServerOptions.PerformLayout();
            this.panelHeaderServerOptions.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
            this.tabPageDocumentScope.ResumeLayout(false);
            this.panelHeaderDocScope.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
            this.grpBoxAdvanced.ResumeLayout(false);
            this.grpBoxAdvanced.PerformLayout();
            this.tabPageSsoConfig.ResumeLayout(false);
            this.groupBox1.ResumeLayout(false);
            this.groupBox1.PerformLayout();
            this.panel1.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).EndInit();
            this.tabPageOutputOptions.ResumeLayout(false);
            this.tabPageOutputOptions.PerformLayout();
            this.panelHeaderOuputOptions.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).EndInit();
            this.tabPageOrchectrationInfo.ResumeLayout(false);
            this.panelHeaderOrchestrationInfo.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit();
            this.ResumeLayout(false);

        }

        #endregion

        private FormMain()
        {
            InitializeComponent();


            textBoxDatabaseName.Text = documenter.Database;
            textBoxServerName.Text = documenter.Server;
            textBoxOutputDir.Text = documenter.OutputDir;
            textBoxReportTitle.Text = documenter.ReportName;
            textBoxRulesServer.Text = documenter.RulesServer;
            textBoxRulesDatabase.Text = documenter.RulesDatabase;

            panelHeaderDocScope.MouseDown += HeaderMouseDown;
            panelHeaderOrchestrationInfo.MouseDown += HeaderMouseDown;
            panelHeaderOuputOptions.MouseDown += HeaderMouseDown;
            panelHeaderServerOptions.MouseDown += HeaderMouseDown;

            panelHeaderDocScope.MouseUp += HeaderMouseUp;
            panelHeaderOrchestrationInfo.MouseUp += HeaderMouseUp;
            panelHeaderOuputOptions.MouseUp += HeaderMouseUp;
            panelHeaderServerOptions.MouseUp += HeaderMouseUp;

            panelHeaderDocScope.MouseMove += HeaderMouseMove;
            panelHeaderOrchestrationInfo.MouseMove += HeaderMouseMove;
            panelHeaderOuputOptions.MouseMove += HeaderMouseMove;
            panelHeaderServerOptions.MouseMove += HeaderMouseMove;

            documenter.PercentageDocumentationComplete += DocumenterPercentageDocumentationComplete;

            RenderButtons();
        }

        private void HeaderMouseMove(object sender, MouseEventArgs e)
        {
            if (_drag)
            {
                Point p1 = new Point(e.X, e.Y);
                Point p2 = PointToScreen(p1);
                Point p3 = new Point(p2.X - _startPoint.X,
                                     p2.Y - _startPoint.Y);
                Location = p3;
            }
        }

        private void HeaderMouseUp(object sender, MouseEventArgs e)
        {
            _drag = false;
        }

        private void HeaderMouseDown(object sender, MouseEventArgs e)
        {
            _drag = true;
            _startPoint = new Point(e.X, e.Y);
        }

        /// <summary>
        ///   The main entry point for the application.
        /// </summary>
        [STAThread]
        private static void Main(string[] args)
        {
            TraceManager.SmartTrace.TraceIn();

            documenter = new Documenter();

            if (args.Length > 0)
            {
                ProcessArgs(args);
                // there may have been some overrides of the defaults (in the config)
                ProcessOverrides();
            }
            else
            {
                executionMode = ExecutionMode.Interactive;
            }


            if (showUsage)
            {
                ShowUsage();
                return;
            }

            if (executionMode == ExecutionMode.Interactive)
            {
                documenter.SetDefaults();
                Application.Run(new FormMain());
            }
            else
            {
                FormMain f1 = new FormMain();
                f1.GenerateDocumentation();
            }

            Trace.WriteLine("Completed processing");
            return;
        }

        /// <summary>
        ///   Clean up any resources being used.
        /// </summary>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (components != null)
                {
                    components.Dispose();
                }
            }

            base.Dispose(disposing);
        }

        private static IPublisher DeterminePublisher(string publisherName)
        {
            if (String.IsNullOrEmpty(publisherName) ||
                publisherName.ToLower().Contains("compiled") ||
                publisherName.ToLower().Contains("help") ||
                publisherName.ToLower().Contains("chm"))
            {
                return new CompiledHelpPublisher();
            }

            return new WordXmlPublisher();
        }

        /// <summary>
        /// </summary>
        private void GenerateDocumentation()
        {
            Cursor.Current = Cursors.WaitCursor;

            try
            {
                linkLabelQuit.Visible = false;
                progressBarMain.Visible = true;

                if (!ValidateReportName(documenter.ReportName))
                {
                    throw new ApplicationException("Report title contains some invalid characters.");
                }

                if (radioButtonSpecificBizTalkApp.Checked)
                {
                    if (checkedListBoxApplications.CheckedItems.Count == 0)
                    {
                        MessageBox.Show("No applications have been selected for documentation",
                                        "Error Generating Documentation", MessageBoxButtons.OK,
                                        MessageBoxIcon.Exclamation);
                        return;
                    }

                    documenter.Applications.Clear();

                    foreach (object item in checkedListBoxApplications.CheckedItems)
                    {
                        documenter.Applications.Add(item.ToString());
                    }

                    documenter.IncludeReferences = checkBoxIncludeReferences.Checked;
                    documenter.PublishType = PublishType.SpecificApplication;
                }

                if (executionMode == ExecutionMode.Interactive)
                {
                    documenter.Publisher = DeterminePublisher(comboBoxOutputProvider.SelectedItem.ToString());
                }

                documenter.GenerateDocumentation();
            }
            catch (Exception ex)
            {
#if(DEBUG)
                MessageBox.Show(ex.ToString());
#endif
                if (executionMode == ExecutionMode.Interactive)
                {
                    MessageBox.Show(ex.Message, "Error Generating Documentation", MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                }
                else
                {
                    Console.WriteLine(ex.Message);
                }
            }
            finally
            {
                progressBarMain.Visible = false;
                linkLabelQuit.Visible = true;
                Cursor.Current = Cursors.Default;
            }

            return;
        }

        private void Browse4OutputFolderClick(object sender, EventArgs e)
        {
            DialogResult res = folderBrowserDialog1.ShowDialog();
            if (res == DialogResult.OK)
            {
                textBoxOutputDir.Text = folderBrowserDialog1.SelectedPath;
            }
        }

        private static void ProcessArgs(string[] args)
        {
            ArgParser parser = new ArgParser(args);
            ParserError error;

            //Help is unique as it is not a classic 'argument' with a name and a value
            if (args[0].Equals("/help") || args[0].Equals("/h") || args[0].Equals("/?"))
            {
                showUsage = true;
                return;
            }

            bool useDefaults = parser.Exists("defaults", "def");
            if (useDefaults)
            {
                // Use the documenters in-built defaults where possible
                documenter.SetDefaults();

                documenter.Publisher = DeterminePublisher("Compiled Help");
                documenter.ShowOutput = true;
            }
            else
            {
                documenter.Server = GetSafeString(parser.GetValue("server", "s", out error));
                documenter.Database = GetSafeString(parser.GetValue("database", "d", out error));
                documenter.RulesServer = GetSafeString(parser.GetValue("rs", out error));
                documenter.RulesDatabase = GetSafeString(parser.GetValue("rd", out error));

                documenter.OutputDir = GetSafeString(parser.GetValue("outputdir", "o", out error));
                documenter.ReportName = GetSafeString(parser.GetValue("title", "t", out error));
                GetSafeString(parser.GetValue("commentfile", "c", out error));
                documenter.DocumentRules = parser.Exists("rules");
                documenter.ShowOutput = parser.Exists("show");
            }

            string applications = GetSafeString(parser.GetValue("applications", "a", out error));
            if (!String.IsNullOrEmpty(applications))
            {
                documenter.PublishType = PublishType.SpecificApplication;
                documenter.Applications = SplitStringToArrayList(applications, ",", true);
            }

            string provider = GetSafeString(parser.GetValue("/provider", "p", out error));
            documenter.Publisher = DeterminePublisher(provider);

            // Allow a user specified folder even if the rest is set to defaults
            string outDir = GetSafeString(parser.GetValue("outputdir", "o", out error));
            if (!String.IsNullOrEmpty(outDir))
            {
                if (!Directory.Exists(outDir))
                {
                    //TraceManager.SmartTrace.TraceInfo("attempting to create the specified folder");
                    Directory.CreateDirectory(outDir);
                }
                documenter.OutputDir = outDir;
            }

            // check if a report name is specified
            string reportName = GetSafeString(parser.GetValue("title", "t", out error));
            if (!String.IsNullOrEmpty(reportName))
            {
                documenter.ReportName = reportName;
            }

            // check if rules are specified
            documenter.DocumentRules = parser.Exists("rules");

            // Finally , check if any overrides are specified in the config file
        }

        private static void ProcessOverrides()
        {
            bool allowOverrides = false;
            if (!String.IsNullOrEmpty(ConfigurationManager.AppSettings["allow_cmdline_overrides"]))
            {
                allowOverrides = Boolean.Parse(ConfigurationManager.AppSettings["allow_cmdline_overrides"]);
            }
            // currently we only support specific config overrides
            if (allowOverrides)
            {
                if (!String.IsNullOrEmpty(ConfigurationManager.AppSettings["default_output_folder"]))
                {
                    documenter.OutputDir = ConfigurationManager.AppSettings["default_output_folder"];
                }

                if (!String.IsNullOrEmpty(ConfigurationManager.AppSettings["default_report_name"]))
                {
                    documenter.ReportName = ConfigurationManager.AppSettings["default_report_name"];
                }

                if (!String.IsNullOrEmpty(ConfigurationManager.AppSettings["default_publisher"]))
                {
                    documenter.Publisher =
                        DeterminePublisher(ConfigurationManager.AppSettings["default_publisher"]);
                }
            }
        }

        private static string GetSafeString(string source)
        {
            if (String.IsNullOrEmpty(source))
                return String.Empty;

            return source;
        }

        private static ArrayList SplitStringToArrayList(string source, string delimiter, bool forceLowerCase = false)
        {
            string[] sourceArray = source.Split(delimiter.ToCharArray());
            ArrayList results = new ArrayList();
            foreach (string t in sourceArray)
            {
                results.Add(forceLowerCase ? t.ToLower() : t);
            }

            return results;
        }

        private static void ShowUsage()
        {
            Assembly a = Assembly.GetExecutingAssembly();
// ReSharper disable AssignNullToNotNullAttribute
            StreamReader sr =
                new StreamReader(a.GetManifestResourceStream("Microsoft.Services.Tools.BiztalkDocumenter.Res.usage.txt"));
// ReSharper restore AssignNullToNotNullAttribute
            string help = sr.ReadToEnd();
            sr.Close();

            MessageBox.Show(help, "Microsoft.Services.Tools.BiztalkDocumenter Usage");
        }

        private void RadioButtonSpecificBizTalkAppCheckedChanged(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            if (((RadioButton) sender).Checked)
            {
                checkedListBoxApplications.Items.Clear();

                BizTalkInstallation bi = new BizTalkInstallation
                                             {
                                                 Server = textBoxServerName.Text,
                                                 MgmtDatabaseName = textBoxDatabaseName.Text
                                             };

                ArrayList applications = bi.GetApplicationNames();

                int appCount = applications.Count;

                if (appCount > 0)
                {
                    checkedListBoxApplications.Enabled = true;
                    checkedListBoxApplications.BackColor = SystemColors.Window;

                    foreach (object o in applications)
                    {
                        checkedListBoxApplications.Items.Add(o);
                    }
                }
                else
                {
                    checkedListBoxApplications.Items.Add(
                        "No BizTalk Applications found, select 'Application Definition' to configure applications");
                }
            }
            else
            {
                checkedListBoxApplications.BackColor = SystemColors.InactiveBorder;
                checkedListBoxApplications.Enabled = false;
                checkedListBoxApplications.Items.Clear();
            }
            Cursor.Current = Cursors.Default;
            return;
        }

        private void DocumenterPercentageDocumentationComplete(int percentage)
        {
            progressBarMain.Value = percentage;
        }

        /// <summary>
        /// </summary>
        /// <param name = "reportName"></param>
        /// <returns></returns>
        private bool ValidateReportName(string reportName)
        {
            if (reportName.IndexOfAny(new[] {"\"".ToCharArray()[0], '/', '*', ':', '?', '"', '<', '>', '|'}) >= 0)
            {
                return false;
            }
            return true;
        }

        private void TreeViewOrchestrationsDoubleClick(object sender, EventArgs e)
        {
            DisplayOrchestration();
        }

        /// <summary>
        /// </summary>
        private void DisplayOrchestration()
        {
            try
            {
                if (treeViewOrchestrations.SelectedNode != null &&
                    treeViewOrchestrations.SelectedNode.Tag != null)
                {
                    string tagString = treeViewOrchestrations.SelectedNode.Tag as string;
                    if (tagString != null)
                    {
                        string[] nameParts = tagString.Split(new[] {'|'}, 2);
                        string asmName = nameParts[0];
                        string orchName = nameParts[1];

                        BizTalkInstallation bTalkInstallation = new BizTalkInstallation
                                                                    {
                                                                        Server = textBoxServerName.Text,
                                                                        MgmtDatabaseName = textBoxDatabaseName.Text
                                                                    };

                        Orchestration o = bTalkInstallation.GetOrchestration(asmName, orchName);
                        OrchestrationViewer ov = new OrchestrationViewer(o);
                        ov.ShowDialog(this);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error displaying orchestration: " + ex, "Error", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
        }

        private void TreeViewOrchestrationsAfterCheck(object sender, TreeViewEventArgs e)
        {
            foreach (TreeNode tn in e.Node.Nodes)
            {
                tn.Checked = e.Node.Checked;
            }
        }

        private void IncludeRulesChecked(object sender, EventArgs e)
        {
            CheckBox cb = (CheckBox) sender;
            label7.Enabled = cb.Checked;
            label8.Enabled = cb.Checked;
            textBoxRulesDatabase.Enabled = cb.Checked;
            textBoxRulesServer.Enabled = cb.Checked;
            documenter.DocumentRules = cb.Checked;
        }

        private void ButtonBrowse4ResourceFolderClick(object sender, EventArgs e)
        {
            DialogResult res = folderBrowserDialog1.ShowDialog();
            if (res == DialogResult.OK)
            {
                textBoxResourceFolder.Text = folderBrowserDialog1.SelectedPath;
            }
        }

        private void ComboBoxOutputProviderSelectedIndexChanged(object sender, EventArgs e)
        {
            ComboBox cb = (ComboBox) sender;

            switch (cb.SelectedItem.ToString().ToLower())
            {
                case "compiled help":
                    textBoxResourceFolder.Enabled = true;
                    break;

                default:
                    textBoxResourceFolder.Enabled = false;
                    break;
            }
            return;
        }

        private void LinkLabelViewCurrentOrchectrationLinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            DisplayOrchestration();
        }

        private void LinkLabelQuitLinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            Application.Exit();
        }

        private void LinkLabelGenerateLinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            documenter.Server = textBoxServerName.Text;
            documenter.Database = textBoxDatabaseName.Text;
            documenter.OutputDir = textBoxOutputDir.Text;
            documenter.ReportName = textBoxReportTitle.Text;
            documenter.ShowOutput = checkBoxShowOutput.Checked;
            documenter.RulesServer = textBoxRulesServer.Text;
            documenter.RulesDatabase = textBoxRulesDatabase.Text;
            documenter.DocumentRules = checkBoxRulesConfig.Checked;
            documenter.ResourceFolder = textBoxResourceFolder.Text;
            documenter.IncludeReferences = checkBoxIncludeReferences.Checked;
            documenter.SsoBuild = textBoxSsoBuild.Text;
            documenter.SsoStage = textBoxSsoStage.Text;
            documenter.SsoTest = textBoxSsoTest.Text;
            documenter.SsoProd = textBoxSsoProd.Text;
            documenter.BizTalkXmlConfig = textBoxConfigFrameworkFile.Text;

            if (listBoxSsoApplications.CheckedItems.Count > 0)
            {
                string[] ssoApplications = new string[listBoxSsoApplications.CheckedItems.Count];
                int loopIndex = 0;
                foreach (string checkedItem in listBoxSsoApplications.CheckedItems)
                {
                    ssoApplications[loopIndex++] = checkedItem;
                }
                documenter.SsoApplications = ssoApplications;
            }


            GenerateDocumentation();
        }

        private void LinkLabelSaveSelectedOrchestrationsLinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            try
            {
                int numOrchsToSave =
                    (from TreeNode asmNode in treeViewOrchestrations.Nodes from TreeNode tn in asmNode.Nodes select tn).
                        Count(tn => tn.Checked && tn.Tag != null);

                if (numOrchsToSave > 0)
                {
                    DialogResult res = folderBrowserDialog1.ShowDialog();

                    if (res == DialogResult.OK)
                    {
                        Cursor.Current = Cursors.WaitCursor;
                        progressBarMain.Visible = true;

                        string dirName = folderBrowserDialog1.SelectedPath;

                        if (Directory.Exists(dirName))
                        {
                            BizTalkInstallation bTalkInstallation = new BizTalkInstallation
                                                                        {
                                                                            Server = textBoxServerName.Text,
                                                                            MgmtDatabaseName =
                                                                                textBoxDatabaseName.Text
                                                                        };

                            int counter = 0;
                            foreach (TreeNode asmNode in treeViewOrchestrations.Nodes)
                            {
                                foreach (TreeNode tn in asmNode.Nodes)
                                {
                                    if (tn.Checked && tn.Tag != null)
                                    {
                                        string tagString = tn.Tag as string;
                                        if (tagString != null)
                                        {
                                            string[] nameParts = tagString.Split(new[] {'|'}, 2);
                                            string asmName = nameParts[0];
                                            string orchName = nameParts[1];

                                            Orchestration o = bTalkInstallation.GetOrchestration(asmName, orchName);

                                            string fileName = Path.Combine(dirName, o.Name + ".jpg");
                                            o.SaveAsImage(fileName);
                                        }
                                        counter++;
                                        DocumenterPercentageDocumentationComplete(100/numOrchsToSave*counter);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error Listing Saving Orchestrations", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
            finally
            {
                progressBarMain.Visible = false;
                Cursor.Current = Cursors.Default;
            }
            return;
        }

        /// <summary>
        ///   List Orchestrations
        /// </summary>
        /// <param name = "sender"></param>
        /// <param name = "e"></param>
        private void LinkLabelListOrchestrationsLinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            try
            {
                treeViewOrchestrations.Nodes.Clear();
                bizTalkInstallation = new BizTalkInstallation
                                          {
                                              Server = textBoxServerName.Text,
                                              MgmtDatabaseName = textBoxDatabaseName.Text
                                          };

                ArrayList names = bizTalkInstallation.GetOrchestrationNames();
                TreeNode asmNode = null;

                foreach (string orchAsmNameCombo in names)
                {
                    string[] nameParts = orchAsmNameCombo.Split(new[] {'|'}, 2);
                    string asmName = nameParts[0];
                    string orchName = nameParts[1];

                    if (asmNode == null || asmName != asmNode.Text)
                    {
                        asmNode = new TreeNode(asmName, 0, 0);
                        treeViewOrchestrations.Nodes.Add(asmNode);
                    }

                    TreeNode orchNode = new TreeNode(orchName, 1, 1) {Tag = orchAsmNameCombo};
                    asmNode.Nodes.Add(orchNode);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error Listing Deployed Orchestrations", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }

        private void ButtonbuttonBrowse4FileClick(object sender, EventArgs e)
        {
            DialogResult res = dlgConfigFrameworkOpenFile.ShowDialog();

            if (res == DialogResult.OK)
            {
                textBoxConfigFrameworkFile.Text = dlgConfigFrameworkOpenFile.FileName;
            }
        }

        private void FormMainLoad(object sender, EventArgs e)
        {
            comboBoxOutputProvider.Items.
                AddRange(new object[]
                             {
                                 "Compiled Help", "Word 2003 Xml"
                             });
            comboBoxOutputProvider.SelectedIndex = 0;
        }


        private void Go()
        {
            Cursor = Cursors.Default;
            Enabled = true;
        }

        private void Wait()
        {
            Cursor = Cursors.WaitCursor;
            Enabled = false;
        }

        

        private void LinkLabelNextLinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (tabControlMain.SelectedIndex < 3)
            {
                tabControlMain.SelectedIndex++;
                RenderButtons();
            }
        }

        private void LinkLabelPreviousLinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (tabControlMain.SelectedIndex > 0)
            {
                tabControlMain.SelectedIndex--;
                RenderButtons();
            }
        }


        private void RenderButtons()
        {
            linkLabelNext.Visible = tabControlMain.SelectedIndex != 3;
            linkLabelPrevious.Visible = tabControlMain.SelectedIndex != 0;
            linkLabelGenerate.Visible = tabControlMain.SelectedIndex == 3;
            RenderTabPage();
        }

        private void RenderTabPage()
        {
            switch (tabControlMain.SelectedIndex)
            {
                case 2:
                    if (listBoxSsoApplications.Items.Count == 0)
                    {
                        Wait();
                        tabControlMain.SelectedTab = tabPageSsoConfig;
                        string[] currentUserApplications = ConfigManager.GetCurrentUserApplications();
                        foreach (string currentUserApplication in currentUserApplications)
                        {
                            if (!currentUserApplication.StartsWith("{") && !currentUserApplication.EndsWith("}"))
                                listBoxSsoApplications.Items.Add(currentUserApplication);
                        }
                        Go();
                    }
                    break;
            }
        }

        private void ButtonSsoClick(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog
            {
                Filter = "XML|*.xml",
                Multiselect = false,
                Title = "Select SSO Configuration"
            };

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                Button thisButton =
                    (Button)sender;

                switch (thisButton.Name)
                {
                    case "buttonSsoBuild":
                        textBoxSsoBuild.Text = ofd.FileName;
                        break;
                    case "buttonSsoStage":
                        textBoxSsoStage.Text = ofd.FileName;
                        break;
                    case "buttonSsoTest":
                        textBoxSsoTest.Text = ofd.FileName;
                        break;
                    case "buttonSsoProd":
                        textBoxSsoProd.Text = ofd.FileName;
                        break;


                }

                
            }
        }
    }
}